def main_window():
    import tkinter as tk
    from function.window_function import save_json,load_json,change_attendance_of_student,button_sum,on_button_click_check,photo_path,save_as_CSV


    window = tk.Tk()
    window.geometry('800x600')
    window.title('Assistant Tool To Professor')
    
    student_information = load_json('student_information/student_information.json')
    
    label_text1 = tk.Label(window,text='student list')
    label_text1.pack()

    listbox = tk.Listbox(window,height=10,width=40)
    listbox.pack()
    for each_student in student_information.keys():
        english_name = student_information[each_student]['english_name']
        attendance = student_information[each_student]['absent_or_present']
        listbox.insert(tk.END,f"{each_student}(English name:{english_name.title()})")
          
    button_check = tk.Button(window,text='check',command=lambda:on_button_click_check(listbox.curselection(),
                                                                                student_information,
                                                                                label_student_id,
                                                                                label_chinese_name,
                                                                                label_english_name,
                                                                                label_group_number,
                                                                                label_absent_or_present,
                                                                                label_photo))
    button_check.pack()

    label_text2 = tk.Label(window,text='Student Information')
    label_text2.pack()


    label_photo = tk.Label(window,image='')
    label_photo.pack()

    label_student_id = tk.Label(window,
                                text='student id:')
    label_chinese_name = tk.Label(window,
                                  text='chinese name:')
    label_english_name = tk.Label(window,
                                  text='english name:')
    label_group_number = tk.Label(window,
                                  text='group_number:')
    label_absent_or_present = tk.Label(window,
                                       text='')
    label_student_id.pack()
    label_chinese_name.pack()
    label_english_name.pack()
    label_group_number.pack()
    label_absent_or_present.pack()

    label_text3 = tk.Label(window,
                           text='Choose attendance of student')
    label_text3.pack()

    scale_value = tk.IntVar(value=0)
    scale = tk.Scale(window,
                    variable=scale_value,
                    from_=0,
                    to=1,
                    orient='horizontal',
                    length=100,
                    resolution=1,
                    sliderlength=50,
                    showvalue=0               
)
    scale.pack()

    label_absent_or_present_text  = tk.Label(window,text=' Absent   Present ')
    label_absent_or_present_text.pack()

    button_attendance = tk.Button(window,
                                  text='sign in',
                                  command=lambda:button_sum(scale.get(),listbox.curselection(),
                                                            student_information,
                                                            label_student_id,
                                                            label_chinese_name,
                                                            label_english_name,
                                                            label_group_number,
                                                            label_absent_or_present,
                                                            label_photo))
    button_attendance.pack()
    
    button_save_as_CSV = tk.Button(window,text='save as CSV',command=lambda:save_as_CSV('CSV/student_information.csv',student_information))
    button_save_as_CSV.pack()
    window.mainloop()